home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / c / mc51bugs.zip / Q33100 < prev    next >
Text File  |  1988-07-29  |  1KB  |  36 lines

  1. Q33100 No Errors or Warnings for Erroneous sizeof Statement
  2. C Compiler
  3. 5.00 5.10 | 5.10
  4. MS-DOS    | OS/2
  5.  
  6. Summary:
  7.    The compiler fails to generate any warning or error messages
  8. for the following erroneous statement:
  9.  
  10.    i = sizeof (int) 100;     /* 'i' is an int */
  11.  
  12.    The sizeof operator is expecting either a type name or an
  13. expression; however, in this case, the operator is given neither
  14. because "(int) 100" is not a legal C expression. The compiler should
  15. generate a syntax error for this line.
  16.    Microsoft has confirmed this to be a problem in C Versions 5.00 and
  17. 5.10. We are researching this problem and will post new information
  18. as it becomes available.
  19.  
  20. More Information:
  21.    The following are legal sizeof statements:
  22.  
  23.    i = sizeof (int);         /* the size of a type name */
  24.    i = sizeof 100;           /* the size of a constant expression */
  25.    i = sizeof ((int) 100);   /* the extra parentheses are needed */
  26.  
  27.    For a precise definition of what the sizeof operator takes as
  28. arguments, and what constitutes a legal C expression, please refer to
  29. the Microsoft C Optimizing Compiler "Language Reference Manual," or
  30. the "The C Programming Language," by Kernighan and Ritchie, or to the
  31. Draft Proposed ANSI standard for C.
  32.  
  33.  
  34. Keywords:  buglist5.00 buglist5.10
  35. Updated  88/07/29 12:16
  36.